using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace Shrapnel
{
	/// <summary>
	/// A cable between two connectors
	/// </summary>
	[DataContract()]
	public abstract class Cable : Element
	{
		/// <summary>
		/// The connector this cable starts at
		/// </summary>
		[DataMember(Name="From")]
		private Connector from = null;

		/// <summary>
		/// The connector this cable ends at
		/// </summary>
		[DataMember(Name = "To")]
		private Connector to = null;


		/// <summary>
		/// The connector this cable starts at
		/// </summary>
		public Connector From
		{
			get { return from; }
		}

		/// <summary>
		/// The connector this cable ends at
		/// </summary>
		public Connector To
		{
			get { return to; }
		}


		/// <summary>
		/// Construct a fresh new instance
		/// </summary>
		/// <param name="from">Start connector</param>
		/// <param name="to">End connector</param>
		public Cable(Connector from, Connector to)
		{
			this.from = from;
			this.to = to;

			RecalculateOccupiedArea();
		}


		/// <summary>
		/// Recalculate the area used by this cable
		/// </summary>
		public abstract void RecalculateOccupiedArea();
	}
}
